# Built-In Example AI

# Title: CircleTurtle
# Author: Adam Rumpf
# Version: 1.0.0
# Date: 11/12/2020

import game.tcturtle

class CombatTurtle(game.tcturtle.TurtleParent):
    """Test circular combat turtle.

    This turtle simply travels in circles and periodically shoots.
    """

    #-------------------------------------------------------------------------

    def class_name():
        """CombatTurtle.class_name() -> str
        Static method to return the name of the Combat Turtle AI.
        """

        return "wodiguigui"

    #-------------------------------------------------------------------------

    def class_desc():
        """CombatTurtle.class_desc() -> str
        Static method to return a description of the Combat Turtle AI.
        """

        return "male male male mawale"

    #-------------------------------------------------------------------------

    def class_shape():
        """CombatTurtle.class_shape() -> (int or tuple)
        Static method to define the Combat Turtle's shape image.

        The return value can be either an integer or a tuple of tuples.

        Returning an integer index selects one of the following preset shapes:
            0 -- arrowhead (also default in case of unrecognized index)
            1 -- turtle
            2 -- plow
            3 -- triangle
            4 -- kite
            5 -- pentagon
            6 -- hexagon
            7 -- star

        A custom shape can be defined by returning a tuple of the form
        (radius, angle), where radius is a tuple of radii and angle is a tuple
        of angles (in radians) describing the polar coordinates of a polygon's
        vertices. The shape coordinates should be given for a turtle facing
        east.
        """

        return 1

    #=========================================================================

    def setup(self):
        """CombatTurtle.setup() -> None
        Initialization code for Combat Turtle.
        """


    # -------------------------------------------------------------------------

    def step(self):
        """CombatTurtle.setup() -> None
        Step event code for Combat Turtle.
        """

        # Turn towards opponent


        # Move towards opponent (or away if too close)
        """if self.distance() > 4 * self.missile_radius:
            self.forward()
        else:
            self.backward()"""


        # Shoot if facing opponent and there is line of sight
        """if (self.can_shoot and abs(self.relative_heading_towards()) <= 10 and
                self.line_of_sight()):
            self.shoot()
        else:"""
        if (self.other_cooldown == 0):
            self.turn_towards()
        self.left(1)
        self.backward()
        if (self.can_shoot):
            self.turn_towards()
            if(self.line_of_sight() == False):
                self.forward(1)
                self.left(0.08)
            if(abs(self.relative_heading_towards()) <= 10 and self.line_of_sight()):
                self.shoot()





